Skip to content

Modernize tests#428

Closed
dgageot wants to merge 3 commits into
docker:mainfrom
dgageot:modernize-tests
Closed

Modernize tests#428
dgageot wants to merge 3 commits into
docker:mainfrom
dgageot:modernize-tests

Conversation

@dgageot
Copy link
Copy Markdown
Member

@dgageot dgageot commented Jan 20, 2026

This was produced by a cagent based agent that looks for modern Go test api usage.

Replace context.Background() with t.Context() in test files for modern Go testing patterns (Go 1.24+).

Assisted-By: cagent
Add golangci-lint rules to enforce:
- Using t.TempDir() instead of os.MkdirTemp in tests
- Using t.Context() instead of context.Background()/TODO() in tests
- No print statements in test code

Assisted-By: cagent
Benehiko
Benehiko previously approved these changes Jan 21, 2026
@Benehiko Benehiko requested review from Copilot and joe0BAB January 21, 2026 12:55
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR modernizes Go test code by replacing manual context.Background() calls with the newer t.Context() method introduced in Go 1.18. The changes also add linter rules to enforce this pattern going forward.

Changes:

  • Updated test code to use t.Context() instead of context.Background()
  • Added forbidigo linter rules to prevent future use of deprecated test patterns
  • Configured linter to scope test-specific rules to test files only

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
store/keychain/keychain_test.go Replaced context.Background() with t.Context() in cleanup functions
engine/internal/runtime/plugin_test.go Replaced context.Background() with t.Context() in plugin test assertions
.golangci.yml Added forbidigo linter with rules to enforce modern test patterns

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .golangci.yml Outdated
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants